package com.yili.oa.dao;

import com.yili.oa.models.DealersLevel;
import com.yili.oa.models.DealersLevelExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface DealersLevelMapper {
    @SelectProvider(type=DealersLevelSqlProvider.class, method="countByExample")
    long countByExample(DealersLevelExample example);

    @DeleteProvider(type=DealersLevelSqlProvider.class, method="deleteByExample")
    int deleteByExample(DealersLevelExample example);

    @Delete({
        "delete from t_dealers_level",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into t_dealers_level (id, name, ",
        "rebate_point_grade_one, rebate_point_grade_two, ",
        "rebate_point_grade_three, necessary_experience, ",
        "create_time)",
        "values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, ",
        "#{rebatePointGradeOne,jdbcType=INTEGER}, #{rebatePointGradeTwo,jdbcType=INTEGER}, ",
        "#{rebatePointGradeThree,jdbcType=INTEGER}, #{necessaryExperience,jdbcType=BIGINT}, ",
        "#{createTime,jdbcType=BIGINT})"
    })
    int insert(DealersLevel record);

    @InsertProvider(type=DealersLevelSqlProvider.class, method="insertSelective")
    int insertSelective(DealersLevel record);

    @SelectProvider(type=DealersLevelSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="rebate_point_grade_one", property="rebatePointGradeOne", jdbcType=JdbcType.INTEGER),
        @Result(column="rebate_point_grade_two", property="rebatePointGradeTwo", jdbcType=JdbcType.INTEGER),
        @Result(column="rebate_point_grade_three", property="rebatePointGradeThree", jdbcType=JdbcType.INTEGER),
        @Result(column="necessary_experience", property="necessaryExperience", jdbcType=JdbcType.BIGINT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.BIGINT)
    })
    List<DealersLevel> selectByExample(DealersLevelExample example);

    @Select({
        "select",
        "id, name, rebate_point_grade_one, rebate_point_grade_two, rebate_point_grade_three, ",
        "necessary_experience, create_time",
        "from t_dealers_level",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="rebate_point_grade_one", property="rebatePointGradeOne", jdbcType=JdbcType.INTEGER),
        @Result(column="rebate_point_grade_two", property="rebatePointGradeTwo", jdbcType=JdbcType.INTEGER),
        @Result(column="rebate_point_grade_three", property="rebatePointGradeThree", jdbcType=JdbcType.INTEGER),
        @Result(column="necessary_experience", property="necessaryExperience", jdbcType=JdbcType.BIGINT),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.BIGINT)
    })
    DealersLevel selectByPrimaryKey(Long id);

    @UpdateProvider(type=DealersLevelSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") DealersLevel record, @Param("example") DealersLevelExample example);

    @UpdateProvider(type=DealersLevelSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") DealersLevel record, @Param("example") DealersLevelExample example);

    @UpdateProvider(type=DealersLevelSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(DealersLevel record);

    @Update({
        "update t_dealers_level",
        "set name = #{name,jdbcType=VARCHAR},",
          "rebate_point_grade_one = #{rebatePointGradeOne,jdbcType=INTEGER},",
          "rebate_point_grade_two = #{rebatePointGradeTwo,jdbcType=INTEGER},",
          "rebate_point_grade_three = #{rebatePointGradeThree,jdbcType=INTEGER},",
          "necessary_experience = #{necessaryExperience,jdbcType=BIGINT},",
          "create_time = #{createTime,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(DealersLevel record);
}